package com.bw.my.mvvm.viewmodel;

import androidx.databinding.ObservableField;

import com.bw.mvvm.custom.BottomCustom;
import com.bw.mvvm.entity.BaseEntity;
import com.bw.mvvm.fleld.UIField;
import com.bw.mvvm.mvvm.viewmodel.BaseViewModel;
import com.bw.my.mvvm.model.MyModel;
import com.bw.my.mvvm.user.LoginActivity;
import com.bw.my.mvvm.user.RegActivity;
import com.bw.my.mvvm.view.ShipAddressActivity;

import java.util.HashMap;

public class MyViewModel extends BaseViewModel<MyModel> implements BottomCustom.BottomSelectLinstenner {

    public ObservableField<String> loginTitle = new ObservableField<>();
    public ObservableField<String> regTitle = new ObservableField<>();

    @Override
    protected void result(BaseEntity entity) {

    }

    @Override
    public void onselect(int id) {

    }

    @Override
    public void onCreate() {
        super.onCreate();
//        String user = SpUtils.getUser();
//        if (user != null){
//            loginTitle.set(user);
//        }else {
//            loginTitle.set("登录 / ");
//            regTitle.set("注册");
//        }
    }

    public void userLogin(){
        HashMap<String,Object>map = new HashMap<>();
        map.put(UIField.PAGECS, LoginActivity.class);
        startPage(map);
    }
    public void userReg(){
        HashMap<String,Object>map = new HashMap<>();
        map.put(UIField.PAGECS, RegActivity.class);
        startPage(map);
    }

    public void goodsManagement(){
        HashMap<String,Object> map = new HashMap<>();
        map.put(UIField.PAGECS, ShipAddressActivity.class);
        startPage(map);
    }

}
